package com.youkeda.test.j3.c2;

import com.alibaba.fastjson.JSON;

import java.util.Map;

/**
 * @author xshuai
 */
public class ObjectAssembler2 {
    public static void main(String[] args) {
        Apartment2 apartment2 = new Apartment2();
        apartment2.setName("研究生公寓");
        apartment2.setAddress("杭州市江干区学林街628号");
        apartment2.setTotalRooms(54);
        apartment2.setBuildtupArea("380平米");
        String content = JSON.toJSONString(apartment2);
        Apartment2 apartment1 = JSON.parseObject(content, Apartment2.class);
        System.out.println("Apartment2对象建筑面积=" + apartment1.getBuildtupArea());
        Map map = JSON.parseObject(content, Map.class);
        System.out.println("Map.address值=" + map.get("address"));
    }
}
